<%@ page language="java" contentType="text/html; charset=UTF-8" import="org.foreveross.que.infra.base.constant.SysConstants"
    pageEncoding="UTF-8"%>
   <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<DIV class="alert alert-block alert-success">
<div  id="menuDesc"></div>


<c:if test="${vo.authority eq '1' }">
<div id="updateMneuDescBtn" onclick ="toUpdateMneuDesc();" style="position:absolute; right:50;" class="btn btn-mini btn-default"> <i class="icon-edit"></i> 编辑 </div>
&nbsp;
<div id="menuDescEdit" style="display: none">
<textarea name="vo.menuDesc" id="menuDescEditVal" rows="5" style="width:99%" data-provide="typeahead"></textarea>
</div>
</c:if>
</DIV>

<script>

<c:if test="${vo.authority eq '1' }">
//如果是运维人员显示该方法
function updateError(){
	alert("修改失败");
}

function toUpdateMneuDesc(){
	$("#menuDesc").hide();
	$("#menuDescEdit").show();
	menuEditor.html($("#menuDesc").html());
	$("#updateMneuDescBtn").attr("onclick","updateMneuDesc();");
	
	$("#updateMneuDescBtn").html('<i class="icon-edit"></i> 提交');
}
function toShowMenuDesc(){
	$("#menuDesc").show();
	$("#menuDescEdit").hide();
	$("#updateMneuDescBtn").attr("onclick","toUpdateMneuDesc();");
	$("#updateMneuDescBtn").html('<i class="icon-edit"></i> 编辑');
}

function updateSuccess(desc){
	//$("#menuDesc").show();
	//$("#mneuDescEdit").hide();
	toShowMenuDesc();
	$("#menuDesc").html(desc);
	menuEditor.html('');
}
/**
 * 更新功能描述
 */
function updateMneuDesc(){
	var url = '${pageContext.request.contextPath}/help/topic/updateMenuDesc.action';
	var mid = $("#mid").val();
	var menuDesc = $.trim(menuEditor.html());//kindEditor方法获取
	if(mid==undefined||mid==''){
		alert("请选择功能");
		return ;
	}
	
	var data = {"vo.mid":mid,"vo.menuDesc":menuDesc};
	ajaxSubmit(url,data,updateSuccess,updateError);
	
}
</c:if>

function findSuccess(desc){
	$("#menuDesc").html(desc);
}

function findError(){
	
}


/**
 * 查找功能描述
 */
function findMneuDesc(){
	var url = '${pageContext.request.contextPath}/help/topic/findMenuDesc.action';
	var mid = $("#mid").val();
	if(mid==undefined||mid==''){
		return ;
	}
	var data = {"vo.mid":mid};
	ajaxSubmit(url,data,findSuccess,findError);
}

</script>